/**
 * 
 */
package com.ez.supervise.service.impl;

import java.util.List;

import com.ez.supervise.core.Page;
import com.ez.supervise.dao.UserAddressDao;
import com.ez.supervise.model.biz.UserAddress;
import com.ez.supervise.service.UserAddressService;

/**
 * @author searph.wang
 * @email searph.wang@gmail.com
 * @Created at 2009-7-22
 * 
 */
public class UserAddressServiceImpl implements UserAddressService {
    private UserAddressDao userAddressDao;
 
    
    public void setUserAddressDao(UserAddressDao userAddressDao) {
        this.userAddressDao = userAddressDao;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#delete(java.lang.Long)
     */
    public void delete(Long id) {
	userAddressDao.delete(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#insert(java.lang.Object)
     */
    public void insert(Object entity) {
	userAddressDao.insert(entity);

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#update(java.lang.Object)
     */
    public void update(Object entity) {
	userAddressDao.update(entity);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#get(java.lang.Long)
     */
    public Object get(Long id) {
	return (UserAddress) userAddressDao.get(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.ez.supervise.service.UserService#findByPage(com.ez.supervise.core
     * .Page)
     */
    public Page findUserAddressByPage(Page page) {
	page.setRoot(userAddressDao.findUserAddressByPage(page));
	page.setTotalProperty(userAddressDao.findUserAddressByCount(page));
	return page;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.UserService#findAllUser()
     */
    public List findAllUserAddress(String userName) {
	return userAddressDao.findAllUserAddress(userName);
    }

    public void publish(List idList, String publishStatus) {
	for(Object id: idList){
	    userAddressDao.publish((Long)id, publishStatus);
	}
    }

    public List findUserAddressByPublish() {
	return userAddressDao.findUserAddressByPublish();
    }
}
